package com.liner.animal;

import java.util.Scanner;

public class RefArrayDemo {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        //声明一个整型数组array,包含5个元素，每个元素都是int型，默认值为0
        int[] array = new int[5];

        //声明一个Dog类型数组dogs，包含3个元素，每个元素都是Dog型，默认值null
        Dog[] dogs = new Dog[3];
        Chick[] chicks = new Chick[2];
        Fish[] fish = new Fish[3];
        fish[0] = new Fish("小黄", 12, "黄色");
        fish[1] = new Fish("小白", 12, "白色");
        fish[2] = new Fish("小蓝", 12, "蓝色");


        dogs[0] = new Dog("bob", 12, "黑色");
        dogs[1] = new Dog("jack", 13, "黄色");
        dogs[2] = new Dog("tom", 14, "幻色");


        for (Fish fish1 : fish) {
            System.out.println(fish1.toString());
            System.out.println(fish1.color);
        }




        for (Dog dog : dogs) {
            dog.swim();
            System.out.println(dog.toString());
        }


    }
}
